<template>
  <el-form ref="searchForm" :model="searchForm" label-width="120px">
    <el-row v-if="conditionCount > 0">
      <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6"><el-form-item label="类型名称" prop="title" label-for="title">
	<el-input v-model="searchForm.title" element-id="title" placeholder="请输入类型名称" clearable @keyup.enter.native="handleSubmit"/>
</el-form-item>
</el-col><el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6"><el-form-item label="类型代码" prop="code" label-for="code">
	<el-input v-model="searchForm.code" element-id="code" placeholder="请输入类型代码" clearable @keyup.enter.native="handleSubmit"/>
</el-form-item>
</el-col>
      <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
        <el-button type="primary" style="margin-left: 10px;" :loading="loading.search" @click="handleSubmit">搜索</el-button>
        <el-button @click="handleReset">重置</el-button>
        <a v-if="conditionCount > 3" style="margin-left: 10px;" @click="collapse = !collapse">
          <el-button type="text" v-if="!collapse">
            展开
            <svg-icon icon-class="ios-arrow-down" />
          </el-button>
          <el-button v-else type="text">
            收起
            <svg-icon icon-class="ios-arrow-up" />
          </el-button>
        </a>
      </el-col>
    </el-row>
    <el-row v-if="collapse">
      
    </el-row>
  </el-form>
</template>
<script>
import * as utils from '@/utils/utils'
import * as ResponseStatus from '@/utils/response-status'
export default {
  name: 'AdvertisementTypeSearchQuick',
  data() {
    return {
      loading: {
        search: false
      },
      conditionCount: 2,
      collapse: false,
      searchForm: {
        pageNo: 1,
        pageSize: 10,
        sortColumn: undefined,
        sortOrder: undefined,
        id: undefined,
idMin: undefined, 
idMax: undefined, 
title: undefined,
code: undefined,
description: undefined,
version: undefined,
versionMin: undefined, 
versionMax: undefined, 
createTime: undefined,
createTimeMin: undefined, 
createTimeMax: undefined, 
updateTime: undefined,
updateTimeMin: undefined, 
updateTimeMax: undefined, 
isActive: undefined,
isActiveMin: undefined, 
isActiveMax: undefined, 

      },
      dataDictCodes: ['YES_NO',],
      selects: {
        isActiveSelect: [],

      }
    }
  },
  computed: {},
  mounted() {
    this.initDataDict()
    utils
      .getDataDict(this.dataDictCodes)
      .then(response => {
        if (response) {
          utils.getSelectDictItems({
            mainComponent: this,
            dataDictItems: response,
            dictCode: 'YES_NO',
            formProp: 'isActive',
            dataProp: 'isActiveSelect'
          })

        }
      })
      .catch(error => {
        console.log(error)
      })
  },
  methods: {
    initDataDict(){

    },
    resetForm(excludeProps) {
      for (let key in this.searchForm) {
        if (excludeProps && excludeProps.includes(key)) {
          continue
        }
        this.searchForm[key] = undefined
      }
    },
    handleSubmit() {
      this.$emit('quickSearch')
    },
    handleReset() {
      this.$emit('researchTable')
    }
  }
}
</script>
<style>
.ivu-quick-opt {
  text-align: right;
}
</style>